home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-11
/
fprotems.zip
/
PROPOPS.TLB
< prev
next >
Wrap
Text File
|
1993-01-04
|
4KB
|
181 lines
<<title Foxpro popup library for PROPOPS.TEM Author: Ellen Sander>>
<<uicode>>
* PROPOPS.TLB
* Last modified 12/19/89
********************************
function declare_all_popboxes **
********************************
* Writes the interior of the popmenu after
* calling declare_popbox to write the box itself.
param b,n
private pm
for all boxes where is_menu(box)
menubox = box
pm = number_of_options_in_box(menubox)
declare_popbox(menubox,n,pm)
if pm > 1 ** popup menu ordinaire
for all options in box
? 'DEFINE BAR {count} OF {box.name} PROMPT '
?? {digest_text(box_text(option,0,0))}
if ! empty(option.message)
* MESSAGE and SKIP [FOR] slot for menu prompt.
?? " ;"
?
munch_slot(option.message)
endif
endfor
endif
if pm = 1 ** variable size popup has only one option in box
* PROMPT FIELDS | FILES | STRUC from option action line 1
if ! empty(option.action[1])
if at("PROMPT", upper(option.action[1]))
autopop_expr = strtran(upper(option.action[1]),'PROMPT', " ")
else
autopop_expr = option.action[1]
endif
?? " ;"
? 'PROMPT {autopop_expr}'
endif
endif
? "ON SELECTION POPUP {box.name} DEACTIVATE POPUP"
?
next
return
**************************
function declare_popbox **
**************************
* Defines the menu box itself, it's message and color scheme #.
param b,n,pm
private numopts
? "* Definition for {b.name}"
if ! empty(b.descrip)
? "* {b.descrip}"
endif
? "DEFINE POPUP {b.name} FROM {b.row}, {b.col}"
if pm >1
?? " TO {b.bottom}, {b.right} "
endif
if ! empty(box.slot1)
* Menubox message slot.
?? "; "
?
munch_slot(box.slot1)
endif
?? " ;"
? "COLOR SCHEME {n}"
return
*******************
function is_menu **
*******************
* If Mr. Box has options, it's a menu. If not, ignore it.
param b
for all options in b
return .t.
endfor
return .f.
**********************
function munch_slot **
**********************
param sl
private s_tokes,i
* Tidies up your generated code by thoughtfully breaking a line
* wherever you may have typed a semi colon in the slot.
* For you mega-expression mavens.
s_tokes = get_tokens("{sl}", '" ; ')
for i = 1 to len(s_tokes)
if i = len(s_tokes)
?? "{s_tokes[i]}"
else
?? "{s_tokes[i]} "
endif
if s_tokes[i] = ";"
?
endif
next
return
***********************
function digest_text **
***********************
* A genuine Wallsoft original
* This little gem manages quotation marks and control chars in a string.
param s
private i,lquote,rquote
if at('"',s)
if at("'",s)
if at("[",s) .or. at("]",s)
s=strtran(s,'"','"+%'"%'+"')
lquote='"'
rquote='"'
else ** no brackets, use them
lquote='['
rquote=']'
endif
else ** no singles, use them
lquote="'"
rquote="'"
endif
else ** no doubles, use them
lquote='"'
rquote='"'
endif
* and quote the string
s=lquote+s+rquote
* check for control characters
if ctrl_in_str(s)
if asc(s[2])<32 ** check first character
s = "chr("+asc(s[2])+")+"+lquote+substr(s,3)
endif
if asc(s[len(s)-1])<32 ** check last character
s = substr(s,1,len(s)-2)+rquote+"+chr("+asc(s[len(s)-1])+")"
endif
for i=3 to len(s)-2 ** scan interior
if asc(s[i])<32
** break control char into '...+chr(n)+...' format
s=substr(s,1,i-1)+rquote+"+chr("+asc(s[i])+")+"+lquote+substr(s,i+1)
i=i+7+(asc(s[i])>9) ** compensate for length increase in s
endif
endfor
* remove any embedded null concatenations
s=strtran(s,'+{lquote}{rquote}+','+')
endif
return s
<<enduicode>>